<html>
  <head>
    <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>hcs-obj-storage | Elvis Zhang</title>
<meta name="description" content="The easy way or the right way." />
<link rel="shortcut icon" href="https://blog.shunzi.tech/favicon.ico">
<link rel="stylesheet" href="https://blog.shunzi.tech/styles/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css">

<script data-ad-client="ca-pub-7661668224317940" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script src="https://blog.shunzi.tech/media/js/jquery.min.js"></script>
<script src="https://blog.shunzi.tech/media/js/masonry.pkgd.min.js"></script>
<script src="https://blog.shunzi.tech/media/js/aos.js"></script>
<script src="https://blog.shunzi.tech/media/js/pace.min.js"></script>
<script src="https://blog.shunzi.tech/media/js/view-image.min.js"></script>
<script src="https://blog.shunzi.tech/media/js/jquery.magnific-popup.min.js"></script>
<script src="https://blog.shunzi.tech/media/js/functions.js"></script>
    <meta name="referrer" content="never">
    <meta name="description" content="

hcs-obj-storage 对象存储封装
相关依赖安装和环境介绍
相关参数解释和文件内存操作封装



Prerequisite
Install Dependencies

self-define library:

cp /c++..." />
    <meta name="keywords" content="项目,C语言,C++" />
    <script src="https://blog.shunzi.tech/media/js/waterfall.min.js"></script>
    <script src="https://blog.shunzi.tech/media/js/prism.min.js"></script>
  </head>
  <body>
            <header id="header" class="grid-container">
        <!-- start: .menu-wrapper -->
        <div class="menu-mobile"> 
          <i class="fa fa-reorder"></i>
        </div>
        <div class="menu-wrapper">
          <div class="">
            <div class="logo">
              <a href="https://blog.shunzi.tech"><img src="\media\images\custom-headerLogo.jpg" alt=""></a>
            </div>
            <!-- start: .main-nav -->

            <nav class="main-nav grid-container grid-parent">
              <ul id="menu-header" class="menu gradient-effect">
                <li class=""><a href="https://blog.shunzi.tech" class="menu">首页</a></li>
                
                  <li class="" >
                    <a href="/archives" class="menu">
                      归档
                    </a>
                  </li>
                
                  <li class="" >
                    <a href="/tag/diary" class="menu">
                      随笔
                    </a>
                  </li>
                
                  <li class="" >
                    <a href="/movies" class="menu">
                      观影
                    </a>
                  </li>
                
                  <li class="" >
                    <a href="/post/about" class="menu">
                      关于
                    </a>
                  </li>
                
                <li class="search-menu-item hide-on-mobile hide-on-tablet"><a href="#search-lightbox" class="lightbox mfp-inline"><i class="fa fa-search-line"></i></a></li>
              </ul>
            </nav>
            <a href="#search-lightbox" class="lightbox epcl-search-button mfp-inline hide-on-tablet hide-on-desktop"><i class="fa fa-search-line"></i></a>
            <!-- end: .main-nav -->
            <div class="clear"></div>
            <div class="border hide-on-tablet hide-on-mobile"></div>
          </div>    
          <div class="clear"></div>
        </div>
        <!-- end: .menu-wrapper -->
        <div class="clear"></div>
      </header>
      <div class="hide-on-mobile hide-on-tablet hide-on-desktop">
        <div id="search-lightbox" class="grid-container grid-small grid-parent mfp-hide">
          <div class="search-wrapper section">
            <form id="gridea-search-form" data-update="1610809361880" action="/search/index.html" class="search-form" _lpchecked="1">
              <input type="text" name="q" id="s" value="" class="search-field" placeholder="搜点啥..." aria-label="搜点啥..." required="">
              <button type="submit" class="submit" aria-label="Submit">
                <i class="fa fa-search-line"></i>
              </button>
            </form>
          </div>
        </div>
      </div>

      <main id="single" class="main grid-container fullcover no-sidebar aos-init aos-animate" data-aos="fade">

        <div class="center content">
          <div class="featured-image cover" style="background-image: url('https://blog.shunzi.tech/post-images/hcs-obj-storage.jpg');">
            <div class="meta top"> 
              <time class="meta-info" style="float:left;" datetime="2020-05-17"><i class="fa fa-calendar"></i><span class="lately">8 个月前</span></time>
              
              <a href="https://blog.shunzi.tech/post/hcs-obj-storage/#comments" class="comments meta-info" title="">
                <i class="fa fa-comment remixicon"></i><span class="comment-count valine-comment-count" data-xid="/hcs-obj-storage/"> </span>
              </a>
              <span id="/hcs-obj-storage/" class="leancloud_visitors views-counter meta-info" title=""><i class="fa fa-leancloud remixicon"></i><span class="leancloud-visitors-count"></span></span>
              
            </div>
            <div class="info">
              <div class="tags ">
                
                      <a href="https://blog.shunzi.tech/tag/NgjQJdkc6/" class="ctag ctag-0 ctag-NgjQJdkc6" aria-label="">项目</a>
                    
                      <a href="https://blog.shunzi.tech/tag/5h7k39FKw/" class="ctag ctag-1 ctag-5h7k39FKw" aria-label="">C语言</a>
                    
                      <a href="https://blog.shunzi.tech/tag/c0aMcnBDAh/" class="ctag ctag-2 ctag-c0aMcnBDAh" aria-label="">C++</a>
                    
              </div>
              <h1 class="title ularge white bold">hcs-obj-storage</h1>
            </div>
          </div>
        </div>  

        <div class="epcl-page-wrapper">
          <div class="left-content grid-70 np-mobile">
            <article class="main-article post">
              <section class="post-content">
                <div class="text">
                  <blockquote>
<ul>
<li>hcs-obj-storage 对象存储封装</li>
<li>相关依赖安装和环境介绍</li>
<li>相关参数解释和文件内存操作封装</li>
</ul>
</blockquote>
<!--more-->
<h2 id="prerequisite">Prerequisite</h2>
<h3 id="install-dependencies">Install Dependencies</h3>
<ul>
<li>self-define library:
<ul>
<li><code>cp /c++/hik_obj/lib/CentOS64/* /usr/lib64/</code></li>
</ul>
</li>
<li>Boost: 注意 hik-sdk 依赖的 boost 版本
<ul>
<li><a href="https://www.boost.org/">C++ Boost Library</a></li>
<li><a href="https://blog.csdn.net/yao_hou/category_8914813.html">CSDN：C++ boost库零基础教程</a></li>
<li><code>yum install boost -y</code></li>
<li><code>yum install boost-devel -y</code></li>
</ul>
</li>
<li>libssl, libcrypto (SSL Handshake) openssl
<ul>
<li><code>ln -s /usr/local/hostguard/lib/libcrypto.so.1.0.0 /usr/lib64/libcrypto.so.1.0.0</code></li>
<li><code>ln -s /usr/lib64/libssl.so /usr/lib64/libssl.so.1.0.0</code></li>
<li><code>ln -s /usr/local/hostguard/lib/libssl.so.1.0.0 /usr/lib64/libssl.so.1.0.0</code></li>
<li><code>ln -s /usr/lib64/libssl.so /usr/lib64/libssl.so.10</code></li>
<li><code>ln -s /usr/lib64/libcrypto.so /usr/lib64/libcrypto.so.10</code></li>
</ul>
</li>
<li>libxml2 (XML Parse)
<ul>
<li><code>yum install libxml2-devel</code></li>
</ul>
</li>
<li>libexpat (XML Parse)
<ul>
<li><code>yum install expat-devel</code></li>
<li><code>ln -s /usr/lib64/libexpat.so /usr/lib64/libexpat.so.0</code></li>
</ul>
</li>
</ul>
<h4 id="libraries">Libraries</h4>
<pre><code>[root@ecs-sn3-medium-2-linux-20200222090658 lib]# tree
.
├── CentOS5.6
│   ├── libanalyzedata.so
│   ├── libboost_chrono.so.1.57.0
│   ├── libboost_filesystem.so.1.57.0
│   ├── libboost_serialization.so.1.57.0
│   ├── libboost_system.so.1.57.0
│   ├── libboost_thread.so.1.57.0
│   ├── libcrypto.so
│   ├── libDycHikSingleThreadDecode.so
│   ├── libhcsnet.so
│   ├── libhcs_object_api.so
│   ├── libhlog.so
│   ├── libMediaACodec.so
│   ├── libMediaAssistant.so
│   ├── libMediaExtractor.so
│   ├── libMediaPostProc.so
│   ├── libMediaVDecode.so
│   ├── libMediaVEncode.so
│   ├── libRainbowApi.so
│   ├── libssl.so
│   ├── libSystemTransform.so
│   └── log4cxx.properties
├── CentOS64
│   ├── libanalyzedata.so
│   ├── libboost_chrono.so.1.57.0
│   ├── libboost_filesystem.so.1.57.0
│   ├── libboost_serialization.so.1.57.0
│   ├── libboost_system.so.1.57.0
│   ├── libboost_thread.so.1.57.0
│   ├── libcrypto.so
│   ├── libDycHikSingleThreadDecode.so
│   ├── libhcsnet.so
│   ├── libhcs_object_api.so
│   ├── libhlog.so
│   ├── libRainbowApi.so
│   ├── libssl.so
│   ├── libSystemTransform.so
│   └── log4cxx.properties
├── SUSE64
│   ├── libanalyzedata.so
│   ├── libboost_chrono.so.1.57.0
│   ├── libboost_filesystem.so.1.57.0
│   ├── libboost_serialization.so.1.57.0
│   ├── libboost_system.so.1.57.0
│   ├── libboost_thread.so.1.57.0
│   ├── libcrypto.so
│   ├── libDycHikSingleThreadDecode.so
│   ├── libhcsnet.so
│   ├── libhcs_object_api.so
│   ├── libhlog.so
│   ├── libRainbowApi.so
│   ├── libssl.so
│   ├── libSystemTransform.so
│   └── log4cxx.properties
...
</code></pre>
<h4 id="error-stack">Error Stack</h4>
<ul>
<li>Get object to file with param error.
<ul>
<li>By analyzing the call stack and capture the http requst, we found the http response is right. So the error may happen parse response data.</li>
<li>Call stack pause on exception, and stop on the <code>libboost_serialization.so.1.53.0.</code> By comparing the version with dependenices, actual dependency of sdk is 1.57.0. So change the version and it worked.</li>
<li>tcpdump dump the req/resp and use wireshark to open.</li>
</ul>
<pre><code class="language-shell"># host filter
# -w   dump to file
# -v   count requests
tcpdump host 113.57.175.178 -w get.pcap -v
</code></pre>
</li>
</ul>
<h3 id="helpful-info">Helpful info</h3>
<h4 id="standard">Standard</h4>
<ul>
<li>In order to support <strong>C</strong> language, we have modified the header in sdk offered by hik. (To fix standard problem).</li>
<li>Old:</li>
</ul>
<pre><code class="language-C">/**
 *表示hik对象存储服务的访问控制列表（Access Control List, ACL),
 *私有表示bucket只能被自己访问
 *只读表示其它用户只能读取该bucket里面的内容
 *能读能写，表示该bucket可以被其它用户读和写
 */
enum HCSAccessACL
{
	PUBLIC_READ_WRITE = 0,      //能读能写
	PUBLIC_READ,				//只读
	PRIVATE,					//私有
};
</code></pre>
<ul>
<li>New:</li>
</ul>
<pre><code class="language-C">/**
 *表示hik对象存储服务的访问控制列表（Access Control List, ACL),
 *私有表示bucket只能被自己访问
 *只读表示其它用户只能读取该bucket里面的内容
 *能读能写，表示该bucket可以被其它用户读和写
 */
typedef enum HCSAccessACL
{
	PUBLIC_READ_WRITE = 0,      //能读能写
	PUBLIC_READ,				//只读
	PRIVATE,					//私有
} HCSAccessACL;
</code></pre>
<ul>
<li>When use <strong>C</strong> language and gcc to build binary program, you should assign some params for gcc command to clear some warings such as <code>-std=c99</code>.</li>
<li>Include some basic dependencies such as expat/ssl.</li>
</ul>
<pre><code>/usr/bin/gcc 
-g /c++/hik_obj/src/object_operation.c 
-L /c++/hik_obj/lib/CentOS64 
-l boost_chrono 
-l boost_filesystem 
-l boost_serialization 
-l boost_system 
-l boost_thread 
-l crypto 
-l DycHikSingleThreadDecode 
-l hcsnet 
-l hcs_object_api 
-l RainbowApi 
-l ssl 
-l SystemTransform 
-l xml2 
-l expat 
-l hlog 
-l analyzedata 
-I /c++/hik_obj/inc 
-o /c++/hik_obj/src/object_operation 
-std=c99
</code></pre>
<h3 id="gui-client">GUI Client</h3>
<ul>
<li>API_DEMO.exe offered by hik.</li>
<li>Steps to use:
<ol>
<li>Init client.</li>
<li>Add user info.</li>
<li>Login.</li>
<li>Operations.</li>
</ol>
</li>
</ul>
<h4 id="memory-allocate-and-free">Memory allocate and free.</h4>
<ul>
<li>allocate : free = 1 : 1 and keep in order</li>
<li>C++: new / delete</li>
<li>C: malloc(calloc) / free</li>
<li>Some params: The pointer of pointer. Such as: **buckets_list</li>
</ul>
<pre><code class="language-C">/**
 * 返回请求者拥有的所有 Bucket 的列表
 * @param client [in] 标识一个HCSClient的结构指针
 * @param buckets_number [out] 所有Bucket的总数
 * @buckets_list [out]返回一个HCSBucketInfo的双重指针，可通过buckets_num来遍历,遍历完之后用户需释放该参数内存
 * @retval 0    表示成功
 * @retval 其他 表示失败
 */
HCS_OBJECT_API int ListBuckets(HCSClient *client, int*buckets_num, HCSBucketInfo **buckets_list);
</code></pre>
<h2 id="sdk">SDK</h2>
<ul>
<li><a href="https://github.com/zjs1224522500/DistBlock/blob/master/hik_obj/inc/hcs_object_api.h">hcs_object_api.h</a></li>
<li>Bucket Operation (Get/Create/Delete/PUT-capcity/acl/...)</li>
<li>Object Operation (Get/Put via File/Buffer)</li>
<li>Stream...</li>
</ul>
<h3 id="parameters">Parameters</h3>
<h4 id="ec-backend-consistency">EC Backend Consistency</h4>
<ul>
<li>N + M : K  (1 + 1 : 1)
<ul>
<li>N：Bucket的EC类型的数据块数量</li>
<li>M：Bucket的EC类型的校验块数量</li>
<li>K：容忍坏节点数</li>
</ul>
</li>
<li>N 个数据块，实际存储 N+M 块（包含 M 个校验块），所以容忍丢失 M 块数据。</li>
<li>K 对应的节点数，和容忍丢失的 M 块数据，取决于数据分布特点。</li>
<li>例如 4+2:X  ：
<ul>
<li>若每个节点布局 2 块数据，三个节点就可以建立集群， X=1</li>
<li>若每个节点存储 1 块数据，需要六个节点建立集群，X=2</li>
</ul>
</li>
</ul>
<pre><code>/**
 * V3.0
 * 创建 Bucket
 * @param client [in] 标识一个HCSClient的结构指针
 * @param bucket_name [in] 要创建的Bucket的名称
 * @param region [in] Bucket里面的数据需要存储的区域,目前只支持&quot;LOCAL-1&quot;
 * @param bucket_size [in] Bucket的容量,单位为GB
 * @param n [in] Bucket的EC类型的数据块数量
 * @param m [in] Bucket的EC类型的校验块数量
 * @retval 0    表示成功
 * @retval 非0  表示失败
 */
HCS_OBJECT_API int CreateBucket_V3(HCSClient *client, const char *bucket_name, const char*region, long long bucket_size,
	                                int n, int m, int k);
</code></pre>
<h2 id="demo">Demo</h2>
<h3 id="test-account">Test account</h3>
<h4 id="apply-access-key-and-secret-key">Apply access key and secret key</h4>
<pre><code>    const char* access_key = &quot;access&quot;;
    const char* secret_key = &quot;secret&quot;;
    const char* endpoint = &quot;ip:port&quot;;
</code></pre>
<h3 id="test-cpp-demo">Test cpp demo</h3>
<ul>
<li>Bucket/Object Operations.</li>
<li>TODO: Use boost library to refator the code.</li>
<li><a href="https://github.com/zjs1224522500/DistBlock/blob/master/hik_obj/src/main.cpp">main.cpp</a></li>
</ul>
<h3 id="test-c-demo">Test c demo</h3>
<ul>
<li><a href="https://github.com/zjs1224522500/DistBlock/blob/master/hik_obj/src/object_operation.c">object_operation.c</a></li>
</ul>
<h4 id="basic-functions">Basic Functions</h4>
<pre><code class="language-C">typedef struct _FileBuffer
{
	char* data;			  
	long long data_len;          
}FileBuffer;

//Declare
HCSClient* createClient();
void listBuckets(HCSClient* client);
void getSingleBucket(HCSClient* client, const char* bucket_name);
void writeObjectFromFile(HCSClient* client, const char* bucketName, const char* key, const char* path);
void getObjectToFile(HCSClient* client, const char* bucketName, const char* key, const char* path);
FileBuffer* getObjectToBuffer(HCSClient* client, const char* bucketName, const char* key);
FileBuffer* getBufferFromFile(const char* path);
void writeObjectFromBuffer(HCSClient* client, const char* bucketName, const char* key, void* buffer, long long date_len);
void createBucket(HCSClient* client, const char* bucketName, long long bucketSize);
void resultHandler(int result, const char* operation, const char* param);
HCSGetObjectRequest* buildGetObjectRequest(const char* bucketName, const char* key);
void freeGetObjectRequest(HCSGetObjectRequest* getReq);
void printBucketInfo(HCSBucketInfo_V3** bucketList, int bucketCount);
void freeFileBuffer(FileBuffer* buffer);
void writeBufferToFile(void* buffer, long long size, const char* path);
void freeHikBuffer(HCSClient *client, char **output);
void deleteObject(HCSClient *client, const char *bucket_name, const char *key);
void deleteBucket(HCSClient *client, const char *bucket_name);
</code></pre>
<h2 id="hcs_obj_util">hcs_obj_util</h2>
<ul>
<li>Write <strong>C</strong> heaader/source code to offer some functions for <code>tcmmu-runner</code>.</li>
<li>Methods:
<ul>
<li>Include header in tcmu and add the dependency in cmake.</li>
<li>Write code in <code>tcmu-runner</code> with <code>hcs_obj_api</code> sdk.</li>
</ul>
</li>
</ul>
<h3 id="header">header</h3>
<ul>
<li>hcs_obj_api.h</li>
</ul>
<pre><code class="language-C">#ifndef _HCS_OBJ_UTIL_
#define _HCS_OBJ_UTIL_

#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdbool.h&gt;
#include &quot;hcs_object_api.h&quot;

typedef struct _FileBuffer
{
	char* data;			  
	long long data_len;          
} FileBuffer;

//Declare
HCSClient* createClient();
void listBuckets(HCSClient* client);
void getSingleBucket(HCSClient* client, const char* bucket_name);
void writeObjectFromFile(HCSClient* client, const char* bucketName, const char* key, const char* path);
void getObjectToFile(HCSClient* client, const char* bucketName, const char* key, const char* path);
FileBuffer* getObjectToBuffer(HCSClient* client, const char* bucketName, const char* key);
FileBuffer* getBufferFromFile(const char* path);
void writeObjectFromBuffer(HCSClient* client, const char* bucketName, const char* key, void* buffer, long long date_len);
void createBucket(HCSClient* client, const char* bucketName, long long bucketSize);
void resultHandler(int result, const char* operation, const char* param);
HCSGetObjectRequest* buildGetObjectRequest(const char* bucketName, const char* key);
void freeGetObjectRequest(HCSGetObjectRequest* getReq);
void printBucketInfo(HCSBucketInfo_V3** bucketList, int bucketCount);
void freeFileBuffer(FileBuffer* buffer);
void writeBufferToFile(void* buffer, long long size, const char* path);
void freeHikBuffer(HCSClient *client, char **output);
void deleteObject(HCSClient *client, const char *bucket_name, const char *key);
void deleteBucket(HCSClient *client, const char *bucket_name);
void freeClient(HCSClient* client);
void listObjects(HCSClient* client, const char* bucketName);


#endif
</code></pre>
<h3 id="implementation">Implementation</h3>
<ul>
<li><a href="https://github.com/zjs1224522500/DistBlock/blob/master/hik_obj/src/hcs_obj_util.c">hcs_obj_util.c</a></li>
</ul>
<h3 id="cmake-build">CMake Build</h3>
<ul>
<li>TODO: Link the libraries more effectively.</li>
</ul>
<pre><code>#指定头文件目录,PROJECT_SOURCE_DIR为工程的根目录  
include_directories(${PROJECT_SOURCE_DIR}/inc)

# add_compile_options( -std=c++11 )
add_compile_options( -std=c99 )

#指定可执行文件的输出目录，输出到bin下面  
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

#生成动态库    
add_library(hcs_obj_util_shared SHARED hcs_obj_util.c)
#设置库输出名为 shared =&gt; libshared.so  
set_target_properties(hcs_obj_util_shared PROPERTIES OUTPUT_NAME &quot;hcs_obj_util&quot;)
target_link_libraries(hcs_obj_util_shared 
-lboost_chrono 
-lboost_filesystem 
-lboost_serialization 
-lboost_system 
-lboost_thread 
-lcrypto 
-lDycHikSingleThreadDecode 
-lhcsnet 
-lhcs_object_api 
-lRainbowApi 
-lssl 
-lSystemTransform 
-lxml2 
-lexpat 
-lhlog 
-lanalyzedata)


#指定库文件输出路径  
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

#指定生成目标
add_executable(hcs_test hcs_obj_test.c)

#链接共享库
target_link_libraries(hcs_test hcs_obj_util_shared)
</code></pre>
<h3 id="test-demo">Test Demo</h3>
<ul>
<li><a href="https://github.com/zjs1224522500/DistBlock/blob/master/hik_obj/src/hcs_obj_test.c">hcs_obj_test.c</a></li>
</ul>
<pre><code class="language-C">#include &quot;hcs_obj_util.h&quot;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdbool.h&gt;
int main() {
    const char* bucketName = &quot;hust&quot;;
    const char* bufferKey = &quot;hello-buffer&quot;;
    const char* fileKey = &quot;hello-file&quot;;
    const char* uploadFilePath = &quot;/c++/DistBlock/hik_obj/data/hust-test.txt&quot;;
    const char* downloadFilePath = &quot;/c++/DistBlock/hik_obj/data/down-hust-test.txt&quot;;
    const char* uploadBufferFilePath = &quot;/c++/DistBlock/hik_obj/data/get.pcap&quot;;
    const char* downloadBufferFilePath = &quot;/c++/DistBlock/hik_obj/data/down-hust-get.pcap&quot;;

    HCSClient* client = createClient();

    // Bucket
    listBuckets(client);
    getSingleBucket(client, bucketName);

    // Object &lt;=&gt; File
    writeObjectFromFile(client, bucketName, fileKey, uploadFilePath);
    getObjectToFile(client, bucketName, fileKey, downloadFilePath);

    // Object &lt;=&gt; Buffer
    FileBuffer* uploadBufferData = getBufferFromFile(uploadBufferFilePath);
    writeObjectFromBuffer(client, bucketName, bufferKey, uploadBufferData-&gt;data, uploadBufferData-&gt;data_len);
    FileBuffer* downloadBufferData = getObjectToBuffer(client, bucketName, bufferKey);
    writeBufferToFile(downloadBufferData-&gt;data, downloadBufferData-&gt;data_len, downloadBufferFilePath);

    freeFileBuffer(uploadBufferData);
    freeFileBuffer(downloadBufferData);

    listObjects(client, bucketName);

    // Delete Object
    deleteObject(client, bucketName, fileKey);
    deleteObject(client, bucketName, bufferKey);

    listObjects(client, bucketName);

    freeClient(client);
    return 0;
}
</code></pre>
<h4 id="output">Output</h4>
<pre><code>list buckets with param [all] succeed!
Bucket Count: 35
No. 1 bucket : { name: 000000001; free_size(GB): 0.000000 }
No. 2 bucket : { name: 100000001; free_size(GB): 11.400000 }
No. 3 bucket : { name: 100000002; free_size(GB): 99.047000 }
No. 4 bucket : { name: 100000003; free_size(GB): 0.000000 }
No. 5 bucket : { name: 100000004; free_size(GB): 0.000000 }
No. 6 bucket : { name: 111; free_size(GB): 798.588000 }
No. 7 bucket : { name: 11111; free_size(GB): 84.558000 }
No. 8 bucket : { name: 111111; free_size(GB): 99.999000 }
No. 9 bucket : { name: 222222; free_size(GB): 500.000000 }
No. 10 bucket : { name: 333333; free_size(GB): 97.582000 }
No. 11 bucket : { name: bucket_yijinli; free_size(GB): 99.998000 }
No. 12 bucket : { name: bucketaaa; free_size(GB): 10.000000 }
No. 13 bucket : { name: buckethxf; free_size(GB): 10.000000 }
No. 14 bucket : { name: cvm; free_size(GB): 12.826000 }
No. 15 bucket : { name: cvm111; free_size(GB): 77.183000 }
No. 16 bucket : { name: hangzhou; free_size(GB): 2856.018000 }
No. 17 bucket : { name: hengxin_bucket; free_size(GB): 100.000000 }
No. 18 bucket : { name: hengxin_bucket2; free_size(GB): 100.000000 }
No. 19 bucket : { name: hengxin_bucket3; free_size(GB): 100.000000 }
No. 20 bucket : { name: hos_0; free_size(GB): 500.000000 }
No. 21 bucket : { name: hos_5; free_size(GB): 500.000000 }
No. 22 bucket : { name: hos_n; free_size(GB): 1749.243000 }
No. 23 bucket : { name: hust; free_size(GB): 9.996000 }
No. 24 bucket : { name: mrt_center_bigpic1; free_size(GB): 0.000000 }
No. 25 bucket : { name: mrt_center_bigpic2; free_size(GB): 0.000000 }
No. 26 bucket : { name: mrt_center_smallpic1; free_size(GB): 0.000000 }
No. 27 bucket : { name: mrt_center_smallpic2; free_size(GB): 0.000000 }
No. 28 bucket : { name: pbgtest; free_size(GB): 0.000000 }
No. 29 bucket : { name: s3bucket; free_size(GB): 999.716000 }
No. 30 bucket : { name: sanfang; free_size(GB): 49.991000 }
No. 31 bucket : { name: sdffg; free_size(GB): 0.000000 }
No. 32 bucket : { name: test; free_size(GB): 91.067000 }
No. 33 bucket : { name: test2; free_size(GB): 10.000000 }
No. 34 bucket : { name: tianjin; free_size(GB): 99.947000 }
No. 35 bucket : { name: tianjin1; free_size(GB): 100.000000 }
get single bucket info with param [hust] succeed!
Bucket Count: 1
No. 1 bucket : { name: hust; free_size(GB): 9.996000 }
upload file as object with param [hello-file] succeed!
get object to file with param [hello-file] succeed!
File is not empty!
upload buffer as object with param [hello-buffer] succeed!
get object to buffer with param [hello-buffer] succeed!
buffer is not empty!
List Objects with param [hust] succeed!
key: hello-buffer, size: 18696
key: hello-file, size: 14
key: testbin, size: 18696
key: testtest, size: 27
delete object with param [hello-file] succeed!
delete object with param [hello-buffer] succeed!
List Objects with param [hust] succeed!
key: testbin, size: 18696
key: testtest, size: 27
</code></pre>

                </div>
                <div class="clear"></div>
              </section>
            </article>
            <div class="clear"></div>

            <section class="related section">
              
              <article class="prev grid-50 tablet-grid-50 grid-parent">
                <div class="thumb cover lazy loaded" style="background-image: url('https://raw.githubusercontent.com/zjs1224522500/PicGoImages/master//img/blog/BigTable_database_large.jpg');"></div>
                 <a href="https://blog.shunzi.tech/post/BigTable-A-Distributed-Storage-System-for-Structured-Data/" class="full-link"></a>
                 <div class="info">
                  <time datetime="2020-05-19">2020-05-19</time>
                  <h4 class="title white no-margin">Bigtable: A Distributed Storage System for Structured Data</h4>
                </div>
                 <span class="epcl-button red">
                  <img src="https://blog.shunzi.tech/media/images/left-arrow.svg" width="15" alt="Left Arrow">
                </span>
                <div class="overlay"></div>
              </article>
              
              
              <article class="next grid-50 tablet-grid-50 grid-parent">
                <div class="thumb cover lazy loaded" style="background-image: url('https://blog.shunzi.tech/post-images/the-log-structured-merge-tree-lsm-tree.png');"></div>
                 <a href="https://blog.shunzi.tech/post/the-log-structured-merge-tree-lsm-tree/" class="full-link"></a>
                 <div class="info">
                  <time datetime="2020-05-08">2020-05-08</time>
                  <h4 class="title white no-margin">The Log-Structured Merge-Tree (LSM-Tree)</h4>
                </div>
                 <span class="epcl-button red">
                  <img src="https://blog.shunzi.tech/media/images/right-arrow.svg" width="15" alt="Left Arrow">
                </span>
                <div class="overlay"></div>
              </article>
              

                <div class="clear"></div>
            </section>

              <div class="clear"></div>
              
            
              <div id="comments" class="bg-white hosted ">
                <div class="clear"></div>
<script>
jQuery(document).ready(function($){
    $('.vemoji-btn').text('😀');
    $("#comments").on('click', 'span.vat',function(){
        $(this).parent('div.vmeta').next("div.vcontent").after($("div.vwrap"));
        $('textarea#veditor').focus();
    })
    if(window.location.hash){
        var checkExist = setInterval(function() {
            if ($(window.location.hash).length) {
                $('html, body').animate({scrollTop: $(window.location.hash).offset().top-200}, 600);
                clearInterval(checkExist);
            }
        }, 100);
    }
})
</script>

              </div>
            

            </div>
          </div>
      </main>

          <footer id="footer" class="grid-container">
        <div class="widgets row gradient-effect">
            <div class="default-sidebar border-effect">
              <div class="grid-33 tablet-grid-50 mobile-grid-100">
                <section id="tag_cloud-2" class="widget widget_epcl_posts_thumbs underline-effect">
                  <h4 class="widget-title title white bordered">最新文章</h4>
                  
                  
                  <article class="item post-0 post type-post status-publish format-standard has-post-thumbnail hentry">
                    <a href="https://blog.shunzi.tech/post/Dostoevsky/" class="thumb hover-effect">
                      <span class="fullimage cover" style="display:block;border-radius:50%;background-image: url('https://raw.githubusercontent.com/zjs1224522500/PicGoImages/master//img/blog/20210112173749.png)');"></span>
                    </a>
                    <div class="info gradient-effect">
                      <time datetime="2021-01-12">2021-01-12</time>
                      <h4 class="title usmall">
                        <a href="https://blog.shunzi.tech/post/Dostoevsky/">Dostoevsky: Better Space-Time Trade-Offs for LSM-Tree Based Key-Value Stores via Adaptive Removal of Superfluous Merging</a>
                      </h4>
                    </div>
                    <div class="clear"></div>
                  </article>
                  
                  
                  
                  <article class="item post-1 post type-post status-publish format-standard has-post-thumbnail hentry">
                    <a href="https://blog.shunzi.tech/post/CRaft/" class="thumb hover-effect">
                      <span class="fullimage cover" style="display:block;border-radius:50%;background-image: url('https://raw.githubusercontent.com/zjs1224522500/PicGoImages/master//img/blog/20200614213040.png');"></span>
                    </a>
                    <div class="info gradient-effect">
                      <time datetime="2020-12-16">2020-12-16</time>
                      <h4 class="title usmall">
                        <a href="https://blog.shunzi.tech/post/CRaft/">CRaft: An Erasure-coding-supported Version of Raft for Reducing Storage Cost and Network Cost</a>
                      </h4>
                    </div>
                    <div class="clear"></div>
                  </article>
                  
                  
                  
                  <article class="item post-2 post type-post status-publish format-standard has-post-thumbnail hentry">
                    <a href="https://blog.shunzi.tech/post/Alluxio/" class="thumb hover-effect">
                      <span class="fullimage cover" style="display:block;border-radius:50%;background-image: url('https://raw.githubusercontent.com/zjs1224522500/PicGoImages/master//img/blog/20201210191906.png');"></span>
                    </a>
                    <div class="info gradient-effect">
                      <time datetime="2020-12-10">2020-12-10</time>
                      <h4 class="title usmall">
                        <a href="https://blog.shunzi.tech/post/Alluxio/">Alluxio</a>
                      </h4>
                    </div>
                    <div class="clear"></div>
                  </article>
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  <div class="clear"></div>
                </section>
              </div>

              <div class="grid-33 tablet-grid-50 mobile-grid-100">
                <section id="tag_cloud-2" class="widget widget_tag_cloud underline-effect">
                  <h4 class="widget-title title white bordered">标签云</h4>
                  <div class="tagcloud">
                    
                      <a href="https://blog.shunzi.tech/tag/l8sKsLUAi/" class="ctag ctag-0 ctag-l8sKsLUAi" aria-label="">KVS</a>
                    
                      <a href="https://blog.shunzi.tech/tag/5uQUdLlSC/" class="ctag ctag-1 ctag-5uQUdLlSC" aria-label="">Paper</a>
                    
                      <a href="https://blog.shunzi.tech/tag/3zCwFWPHxH/" class="ctag ctag-2 ctag-3zCwFWPHxH" aria-label="">存储</a>
                    
                      <a href="https://blog.shunzi.tech/tag/geK0jEW-T/" class="ctag ctag-3 ctag-geK0jEW-T" aria-label="">分布式</a>
                    
                      <a href="https://blog.shunzi.tech/tag/9msH-lUaA/" class="ctag ctag-4 ctag-9msH-lUaA" aria-label="">缓存</a>
                    
                      <a href="https://blog.shunzi.tech/tag/_jfuTNqah/" class="ctag ctag-5 ctag-_jfuTNqah" aria-label="">LSM</a>
                    
                      <a href="https://blog.shunzi.tech/tag/i2b42Y2j6/" class="ctag ctag-6 ctag-i2b42Y2j6" aria-label="">Ceph</a>
                    
                      <a href="https://blog.shunzi.tech/tag/la-n8a0mo/" class="ctag ctag-7 ctag-la-n8a0mo" aria-label="">读书笔记</a>
                    
                      <a href="https://blog.shunzi.tech/tag/os/" class="ctag ctag-8 ctag-os" aria-label="">OS</a>
                    
                      <a href="https://blog.shunzi.tech/tag/oBVOD8v4ou/" class="ctag ctag-9 ctag-oBVOD8v4ou" aria-label="">一致性</a>
                    
                      <a href="https://blog.shunzi.tech/tag/gqgftpk_y/" class="ctag ctag-10 ctag-gqgftpk_y" aria-label="">AI</a>
                    
                      <a href="https://blog.shunzi.tech/tag/shu-ju-ku/" class="ctag ctag-11 ctag-shu-ju-ku" aria-label="">数据库</a>
                    
                      <a href="https://blog.shunzi.tech/tag/n2w6bz87h/" class="ctag ctag-12 ctag-n2w6bz87h" aria-label="">编程语言</a>
                    
                      <a href="https://blog.shunzi.tech/tag/ZnIN9Ge-w/" class="ctag ctag-13 ctag-ZnIN9Ge-w" aria-label="">对象存储</a>
                    
                      <a href="https://blog.shunzi.tech/tag/4zx4ysLGro/" class="ctag ctag-14 ctag-4zx4ysLGro" aria-label="">云计算</a>
                    
                      <a href="https://blog.shunzi.tech/tag/NgjQJdkc6/" class="ctag ctag-15 ctag-NgjQJdkc6" aria-label="">项目</a>
                    
                      <a href="https://blog.shunzi.tech/tag/5h7k39FKw/" class="ctag ctag-16 ctag-5h7k39FKw" aria-label="">C语言</a>
                    
                      <a href="https://blog.shunzi.tech/tag/c0aMcnBDAh/" class="ctag ctag-17 ctag-c0aMcnBDAh" aria-label="">C++</a>
                    
                      <a href="https://blog.shunzi.tech/tag/NF-h45xcE/" class="ctag ctag-18 ctag-NF-h45xcE" aria-label="">iscsi</a>
                    
                      <a href="https://blog.shunzi.tech/tag/Y_nsOD1At/" class="ctag ctag-19 ctag-Y_nsOD1At" aria-label="">SSD</a>
                    
                      <a href="https://blog.shunzi.tech/tag/E2d1yYZcV8/" class="ctag ctag-20 ctag-E2d1yYZcV8" aria-label="">虚拟化</a>
                    
                      <a href="https://blog.shunzi.tech/tag/PhD/" class="ctag ctag-21 ctag-PhD" aria-label="">Ph.D</a>
                    
                      <a href="https://blog.shunzi.tech/tag/ZqEqvRTvl/" class="ctag ctag-22 ctag-ZqEqvRTvl" aria-label="">网络</a>
                    
                      <a href="https://blog.shunzi.tech/tag/PuY19cs53/" class="ctag ctag-23 ctag-PuY19cs53" aria-label="">仿真</a>
                    
                      <a href="https://blog.shunzi.tech/tag/rIIc9E-ZvN/" class="ctag ctag-24 ctag-rIIc9E-ZvN" aria-label="">系统结构</a>
                    
                      <a href="https://blog.shunzi.tech/tag/fu-wu-qi/" class="ctag ctag-25 ctag-fu-wu-qi" aria-label="">服务器</a>
                    
                      <a href="https://blog.shunzi.tech/tag/X-lnqf1Ex/" class="ctag ctag-26 ctag-X-lnqf1Ex" aria-label="">容器</a>
                    
                      <a href="https://blog.shunzi.tech/tag/hbaTDSglx-/" class="ctag ctag-27 ctag-hbaTDSglx-" aria-label="">工具</a>
                    
                      <a href="https://blog.shunzi.tech/tag/EO3XpMf_y/" class="ctag ctag-28 ctag-EO3XpMf_y" aria-label="">Linux</a>
                    
                      <a href="https://blog.shunzi.tech/tag/diary/" class="ctag ctag-29 ctag-diary" aria-label="">Diary</a>
                    
                      <a href="https://blog.shunzi.tech/tag/DyzFtOe6x/" class="ctag ctag-30 ctag-DyzFtOe6x" aria-label="">计算机基础</a>
                    
                      <a href="https://blog.shunzi.tech/tag/oqE3oKihb/" class="ctag ctag-31 ctag-oqE3oKihb" aria-label="">OpenStack</a>
                    
                      <a href="https://blog.shunzi.tech/tag/p_z7gKe6R/" class="ctag ctag-32 ctag-p_z7gKe6R" aria-label="">中间件</a>
                    
                      <a href="https://blog.shunzi.tech/tag/Test/" class="ctag ctag-33 ctag-Test" aria-label="">测试</a>
                    
                      <a href="https://blog.shunzi.tech/tag/Product-Standard/" class="ctag ctag-34 ctag-Product-Standard" aria-label="">Product Standard</a>
                    
                      <a href="https://blog.shunzi.tech/tag/spring/" class="ctag ctag-35 ctag-spring" aria-label="">Spring</a>
                    
                      <a href="https://blog.shunzi.tech/tag/she-ji-mo-shi/" class="ctag ctag-36 ctag-she-ji-mo-shi" aria-label="">设计模式</a>
                    
                      <a href="https://blog.shunzi.tech/tag/mian-jing/" class="ctag ctag-37 ctag-mian-jing" aria-label="">面经</a>
                    
                      <a href="https://blog.shunzi.tech/tag/suan-fa/" class="ctag ctag-38 ctag-suan-fa" aria-label="">算法</a>
                    
                      <a href="https://blog.shunzi.tech/tag/redis/" class="ctag ctag-39 ctag-redis" aria-label="">Redis</a>
                    
                      <a href="https://blog.shunzi.tech/tag/javaweb/" class="ctag ctag-40 ctag-javaweb" aria-label="">JavaWeb</a>
                    
                      <a href="https://blog.shunzi.tech/tag/KyMCZj2Wl/" class="ctag ctag-41 ctag-KyMCZj2Wl" aria-label="">WEB容器</a>
                    
                      <a href="https://blog.shunzi.tech/tag/javase/" class="ctag ctag-42 ctag-javase" aria-label="">JavaSE</a>
                    
                  </div>
                  <div class="clear"></div>
                </section>
              </div>

              <div class="grid-33 tablet-grid-50 mobile-grid-100">
                <section id="epcl_about-2" class="widget widget_epcl_about underline-effect">
                  <h4 class="widget-title title white bordered">关于我</h4>
                  <div class="avatar">
                    <a href="" class="translate-effect thumb"><span class="fullimage cover" style="background-image: url(https://blog.shunzi.tech/images/avatar.png);"></span></a>
                  </div>
                  <div class="info">
                    <h4 class="title small author-name gradient-effect no-margin"><a href="">Elvis Zhang</a></h4>
                    <p class="founder">The easy way or the right way.</p>
                    <div class="social">
                      
                          
                            <a href="https://github.com/zjs1224522500" class="translate-effect" target="_blank"><i class="fa fa-github"></i></a>
                        
                      
                          
                            <a href="https://twitter.com/1224522500Elvis" class="translate-effect" target="_blank"><i class="fa fa-twitter"></i></a>
                        
                      
                        
                      
                        
                      
                        
                      
                    </div> 
                  </div>
                  <div class="clear"></div>
                  </section>
              </div>

            </div>
            <div class="clear"></div>
        </div>

        <div class="logo">
          <a href="https://blog.shunzi.tech"><img src="\media\images\custom-footerLogo.jpg" alt=""></a>
        </div>
        <p class="published border-effect">
          ©2019 共 107 篇文章
          <br/>
          Theme <a href="https://gridea.dev/" target="_blank">「breek」</a> Powered by <a href="https://gridea.dev/" target="_blank">「Gridea」</a>
        </p>
        
        <a href="javascript:void(0)" id="back-to-top" class="epcl-button dark" style="display:none">
          <i class="fa fa-arrow"></i>
        </a>
    </footer>
    
    <div class="clear"></div>

        
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/leancloud-storage/dist/av-min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/valine/1.3.10/Valine.Pure.min.js"></script>
<script>
    new Valine({
        el: '#comments',
        appId: 'Pj5H1z0w7hJlLGJpGBh9NrCq-MdYXbMMI' ,
        appKey: 'LdR8vK5EaBfK87esF7tlbsXe',
        pageSize: 30,
        placeholder: '既然来了，那就留个痕迹吧~',
        visitor: true // 阅读量统计
    })
</script>
    

      
    <script src="https://blog.shunzi.tech/media/js/functions-post.js"></script>

    </div>
    <!-- end: #wrapper -->
  </body>
</html>
